#include <linux/module.h>
#include <linux/kdev_t.h>
#include <linux/fs.h>
#include <linux/platform_device.h>

void photosensorPlatFromRelease(struct device *dev)
{
       // printk("HelloPlatFormReleasee\r\n");
}

struct resource res[] = {
	[0] = {
		.start = 0x11400080,
		.end   = 0x11400083,
		.flags= IORESOURCE_MEM,
	},
	[1] = {
		.start = 0x11400084,
		.end   = 0x11400087,
		.flags= IORESOURCE_MEM,
	},
};
	
static struct platform_device g_stPlatFormDevice =
{
        .name           = "photosensor_dev",
        .dev            = {
                                .release = photosensorPlatFromRelease,
        },
	.resource = res,
};

int photosensorInit(void)
{
        int iRet = 0;
       // printk("module init enter\r\n");
        iRet = platform_device_register(&g_stPlatFormDevice);
if (0 != iRet)
        {
             //   printk("platform_device_register error");
                goto DEVICE_REGISTER_ERR;
        }

       // printk("module init exit\r\n");
        return iRet;

DEVICE_REGISTER_ERR:
        platform_device_unregister(&g_stPlatFormDevice);
        return iRet;
}

void photosensorRelease(void)
{
      //  printk("clean module enter\r\n");
        platform_device_unregister(&g_stPlatFormDevice);
       // printk("clean module exit\r\n");
}

module_exit(photosensorRelease);
module_init(photosensorInit);

MODULE_LICENSE("GPL");


